// package: rewords-server-2024
// filename: config
// author: diogoxiang@gmail.com
// time: 2024/11/8 11:22

package admin

import (
	"github.com/gogf/gf/v2/frame/g"
	"rewords-server-2024/internal/model/entity"
	"rewords-server-2024/internal/model/input/query_in"
)

type ConfListReq struct {
	g.Meta         `path:"/sys/config/query" method:"post" summary:"获取配置列表" tags:"配置"`
	Conditions     []query_in.Condition  `json:"conditions,omitempty" summary:"查找条件"`   // 查找字段
	OrderFields    []query_in.OrderField `json:"order_fields,omitempty" summary:"排序字段"` // 排序字段
	*query_in.Page `json:"page"`
}

type ConfListRes struct {
	Data []entity.SysConfig `json:"list"`
	query_in.PageResult
}

type ConfInfoReq struct {
	g.Meta `path:"/sys/config/query_id" method:"get" summary:"获取配置信息by ID" tags:"配置"`
	Id     int64  `json:"id"  dc:"配置ID"`
	Name   string `json:"name"  dc:"配置名称"`
	Group  string `json:"group"  dc:"配置分组"`
	Key    string `json:"key"  dc:"配置键名"`
}
type ConfInfoRes struct {
	entity.SysConfig
}
type ConfAddReq struct {
	g.Meta `path:"/sys/config/add" method:"post" summary:"添加配置" tags:"配置"`
	entity.SysConfig
}
type ConfAddRes struct {
	Id int64 `json:"id" summary:"配置ID"`
}

type ConfUpdateReq struct {
	g.Meta `path:"/sys/config/update" method:"put" summary:"更新配置" tags:"配置"`
	entity.SysConfig
}
type ConfUpdateRes struct{}

type ConfDeleteReq struct {
	g.Meta `path:"/sys/config/del" method:"get" summary:"删除配置" tags:"配置"`
	Id     int64 `json:"id" v:"required#配置ID不能为空" dc:"配置ID"`
}
type ConfDeleteRes struct{}

type ConfBatchUpdateReq struct {
	g.Meta `path:"/sys/config/batch-update" method:"patch" summary:"批量更新配置" tags:"配置"`
	Rows   []map[string]any `json:"rows"`
}

type ConfBatchUpdateRes struct {
	Rows []int64 `json:"rows"`
}
